/*
 * @Author: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
 * @Date: 2024-05-02 09:26:16
 * @LastEditors: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
 * @LastEditTime: 2024-05-02 16:53:40
 * @FilePath: /named_pipe/PipeClient.cc
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#include "Comm.hpp"
int main()
{
    int wfd = open(Path, O_WRONLY);
    if (wfd < 0)
    {
        cerr << "open fail,errno:" << errno << ",errstring:" << strerror(errno) << endl;
        return 1;
    }
    string inbuffer;
    while (true)
    {
        cout<<"Please Enter Your Message#";
        getline(cin,inbuffer);
        if(inbuffer=="quit")    break;
        ssize_t n = write(wfd,inbuffer.c_str(),inbuffer.size());
        if (n < 0) 
        {
           cerr << "write fail,errno:" << errno << ",errstring:" << strerror(errno) << endl;
           break;
        }
    }
    close(wfd);
    return 0;
}
